package com.cheney.weiboo.view;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;

import com.cheney.weiboo.R;
import com.cheney.weiboo.db.DBHelper;
import com.cheney.weiboo.utils.DBFactory;
//创建登陆的logo
public class LogoActivity extends Activity{
    private DBHelper dbHelper;
    private String dbName = "weiboo.db";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.logo);
		
		//获得DBHelper
		dbHelper = DBFactory.getInstance(getApplicationContext(), dbName);
		
		
		ImageView iv = (ImageView)findViewById(R.id.logo_bg);//获得图片View
		iv.setImageResource(R.drawable.logo);//为控件设置图片
		AlphaAnimation aa = new AlphaAnimation(0.1f,1.0f);//设置透明度过度效果
		aa.setDuration(100);//设置该动画持续多长时间
		iv.startAnimation(aa);
		aa.setAnimationListener(new AnimationListener() {
			@Override
			public void onAnimationStart(Animation animation) {
			}
			@Override
			public void onAnimationRepeat(Animation animation) {
			}
			//设置动画结束时的事件
			@Override
			public void onAnimationEnd(Animation animation) {
				Intent intent = new Intent();
//				intent.setClass(LogoActivity.this, DBTestActivity.class);
//				intent.setClass(LogoActivity.this, MainActivity.class);
				intent.setClass(LogoActivity.this, AccountActivity.class);
				startActivity(intent);
			}
		});
		
	}

}
